# -*- coding: utf-8 -*-
import numpy as np
import math



phi = (1 + math.sqrt(5)) / 2 -1
x1=(1-phi)*10
pjs = (phi*10 -x1 )/5
print(pjs)

x_values = [x1, x1+pjs, x1+2*pjs, x1+3*pjs , x1+4*pjs, phi*10,x1+6*pjs,x1+7*pjs,x1+8*pjs,x1+9*pjs,x1+10*pjs]
y_values = [1236, 1724 ,2130 ,2456, 2700,2862 ,2944 ,2984 ,3033, 3066, 3090]


print(x_values)
# 使用二次多项式拟合
coefficients = np.polyfit(x_values, y_values,2)
a, b, c = coefficients

#定义函数
def calculate_x(x):
    return a * x**2 + b * x +c


print(phi)
# 示例使用 x_input =2000
x_input=8.5
x_output = calculate_x(x_input)
print(f"当x={x_input}时， y={x_output:.2f}")